/*
2021-8-3
https://leetcode-cn.com/problems/maximum-number-of-weeks-for-which-you-can-work/
*/
class Solution {
public:
    long long numberOfWeeks(vector<int>& milestones) {
        long long sum=0;
        int maxv=0;
        for(auto t:milestones)
        {
            sum+=t;
            maxv=max(maxv,t);
        }
        long long ans=sum;
        //cout<<sum<<' '<<maxv<<endl;
        if(maxv>sum-maxv) ans=(sum-maxv)*2+1;
        return ans;
    }
};
